package com.ghsc.ghxc.jsb.ui.my.activity

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.ghxc.jsb.api.ApiMarket
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.my.activity
 * 类名：AboutUsActivity
 * 创建时间：2024/4/25 17:56
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class UpPayPwdViewModel  : BaseViewModel() {

    /** 验证码 **/
    val onPhoneCodeData: MutableLiveData<BaseResponse<Any>> = MutableLiveData()
    fun onPhoneCodeMethod(paras: String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onSendCodeData(paras) }
            executeResponse(
                response,
                { onPhoneCodeData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }

        }
    }
    /** 修改支付密码 **/
    val onSetUpPayPwdData: MutableLiveData<BaseResponse<Any>> = MutableLiveData()
    fun onSetUpPayPwdMethod(paras: String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onSetUpPayPwdData(paras) }
            executeResponse(
                response,
                { onSetUpPayPwdData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }

        }
    }

}